package gang.org.springframework.framework.bean;

import gang.org.springframework.framework.factory.GangConstructorArgumentValues;
import gang.org.springframework.framework.metadata.GangAnnotationMetadata;
import gang.org.springframework.framework.metadata.GangStandardAnnotationMetadata;

/**
 * SpringbootManualApplication 封装为 GangAnnotatedGenericBeanDefinition
 * @author gang.chen
 * @since 2021/6/19 14:31
 */
public class GangAnnotatedGenericBeanDefinition extends GangGenericBeanDefinition implements GangAnnotatedBeanDefinition{

    /**
     * 1 GangAnnotationMetadata接口 ->GangStandardAnnotationMetadata实现类
     * */
    private final GangAnnotationMetadata metadata;

    /**
     * @param beanClass {@link com.gang.mars.boot.SpringbootManualApplication}
     * */
    public GangAnnotatedGenericBeanDefinition(Class beanClass)
    {
        setBeanClass(beanClass);
        this.metadata = GangAnnotationMetadata.introspect(beanClass);
    }

    public GangAnnotatedGenericBeanDefinition(GangAnnotationMetadata metadata){
        /*
         * TODO
         * 业务意义
         * 1)项目启动类封装 GangStandardAnnotationMetadata
         * 2)项目自动装配类封装 GangSimpleAnnotationMetadata
         * */
        if(metadata instanceof GangStandardAnnotationMetadata){

        }else{
            setBeanClassName(metadata.getClassName());
        }
        this.metadata = metadata;
    }

    @Override
    public final GangAnnotationMetadata getMetadata()
    {
        return this.metadata;
    }

    @Override
    public GangConstructorArgumentValues getConstructorArgumentValues() {
        //TODO
        return null;
    }

    @Override
    public boolean hasConstructorArgumentValues() {
        //TODO
        return super.hasConstructorArgumentValues();
    }

    @Override
    public String getParentName() {
        return null;
    }
}
